package com.qianfeng.smartdevice.mapper;

import com.qianfeng.smartdevice.pojo.SysHumiture;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * Created by wenka on 2022/3/28 21:57
 *
 * @author wenkaixin
 * @version 1.0
 * @since 1.0
 */
public interface SysHumitureMapper {
    /**
     * 添加温湿度
     * @param sysHumiture
     */
    @Insert("INSERT INTO sys_humiture (device_id,humidity,temperature,upload_time) VALUES(#{deviceId},#{humidity},#{temperature},#{uploadTime})")
    void addSysHumiture(SysHumiture sysHumiture);

    /**
     * 根据时间查找数据
     * @param start
     * @param stop
     * @return
     */
    @Select("SELECT * FROM sys_humiture WHERE upload_time BETWEEN #{start} and #{stop}")
    List<SysHumiture> findDataByTime(@Param("start") Date start, @Param("stop") Date stop);
}
